package com.nlx.notes.module.helper.sms.core;

import com.nlx.notes.module.helper.sms.AliyunSmsSender;
import com.nlx.notes.module.helper.sms.HuaweiSmsSender;
import com.nlx.notes.module.helper.sms.SmsSender;
import com.nlx.notes.module.helper.sms.TencentSmsSender;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsSenderConfig {

    @Bean
    @ConditionalOnProperty(name = "sms.provider", havingValue = "aliyun", matchIfMissing = true) // 默认阿里云
    public SmsSender aliyunSmsSender() {
        return new AliyunSmsSender();
    }

    @Bean
    @ConditionalOnProperty(name = "sms.provider", havingValue = "tencent")
    public SmsSender tencentSmsSender() {
        return new TencentSmsSender();
    }

    @Bean
    @ConditionalOnProperty(name = "sms.provider", havingValue = "huawei")
    public SmsSender huaweiSmsSender() {
        return new HuaweiSmsSender();
    }


}
